package com.ying.dto;

import org.springframework.data.domain.Page;

import java.util.List;

/**
 * @author ziyan
 * @email 434595824@qq.com
 * @date 2017/10/21
 */
public class PageWrapper<T> {
    Integer code;
    Long count;
    List<T> data;
    String msg;

    public PageWrapper() {
    }

    public PageWrapper(Page page) {
        code = 0;
        count = page.getTotalElements();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }
    public PageWrapper<T> data(List<T> data) {
        this.data = data;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}